package com.pucong.gitee.database.backup.business.service.service;

import com.pucong.gitee.database.backup.common.entity.service.ServiceFile;
import com.pucong.gitee.database.backup.common.entity.service.dto.*;
import com.pucong.gitee.database.backup.common.entity.service.vo.ServiceFileTreeVo;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

public interface ServiceFileService {

    ServiceFile getFileServerById(String id);

    int insertFileServer(ServiceFileSaveDto dto);

    int updateFileServerById(String id, ServiceFileSaveDto dto);

    /**
     * 获取文件服务的目录列表
     *
     * @param id
     * @param cataloguePath
     * @return
     */
    List<ServiceFileTreeVo> getFileServerCatalogueById(String id, String cataloguePath);

    Boolean uploadFile(String uuid, ServiceFileUploadDto dto);

    Boolean uploadFileList(String uuid, ServiceFilesUploadDto dto);

    Boolean deleteFile(String uuid, String path);

    void downLoadFileByPath(String uuid, String path, HttpServletResponse response);

    void lookFileByPath(String uuid, String path, HttpServletResponse response);

    /**
     * 连接测试
     *
     * @param dto
     * @return
     */
    Boolean connectTest(ServiceFileConnectTestDto dto);

    /**
     * 创建目录
     *
     * @param uuid
     * @param dto
     * @return
     */
    Boolean addCatalogue(String uuid, ServiceFileAddDirDto dto);

    /**
     * 删除目录
     * @param uuid
     * @param filePath
     * @return
     */
    Boolean deleteDir(String uuid, String filePath);

    /**
     * 重命名
     * @param uuid
     * @param dto
     * @return
     */
    Boolean rename(String uuid, ServiceFileRenameDto dto);
}
